package Servlet;

import Bean.LoginBean;
import Dao.Impl.StuDaoImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/DelStuServlet")
public class DelStuServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setCharacterEncoding("utf-8");

        LoginBean user=new LoginBean();
        user.setId(req.getParameter("idd"));

        StuDaoImpl stu=new StuDaoImpl();

        stu.DelStu(user);

        req.setAttribute("Msg1", null);
        req.setAttribute("Msg11", null);
        req.setAttribute("Msg2", null);
        req.setAttribute("Msg22", null);
        req.setAttribute("Msg3", "layui-this");
        req.setAttribute("Msg33", "layui-show");
        req.setAttribute("Msg4", null);
        req.setAttribute("Msg44", null);
        req.setAttribute("Msg5", null);
        req.setAttribute("Msg55", null);
        req.setAttribute("Msg6", null);
        req.setAttribute("Msg66", null);

        req.getRequestDispatcher("man_welcome.jsp").forward(req,resp);
    }
}
